/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package bsc.ejb.metadata;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;

/**
 *
 * @author memozac
 */
@Entity
public class Activity implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long idActivity;

    @ManyToMany(targetEntity=Profile.class)
    @JoinTable(name="ProfileActivity",
    joinColumns=@JoinColumn(name="idActivity"),
    inverseJoinColumns=@JoinColumn(name="idProfile"))
    private Collection<Profile> profiles;

    public Collection<Profile> getProfiles() {
        return profiles;
    }

    public void setProfiles(Collection<Profile> profiles) {
        this.profiles = profiles;
    }
    
    public Long getIdActivity() {
        return idActivity;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idActivity != null ? idActivity.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof Activity)) {
            return false;
        }
        Activity other = (Activity) object;
        if ((this.idActivity == null && other.idActivity != null) || (this.idActivity != null && !this.idActivity.equals(other.idActivity))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "bsc.ejb.entity.Activity[id=" + idActivity + "]";
    }

}//ends of class
